package com.tywj.panda.customer.common.entity

import com.google.gson.annotations.SerializedName

/**
 * <pre>
 * author : June Yang
 * time   : 2020/05/08
 * desc   :根据日期查询的价格日历实体类
 * version: 1.0
</pre> *
 */
class CalendarPriceEntity {

    var id = 0

    /**
     * 班次编号
     */
    @SerializedName("store_no")
    var storeNo = ""


    /**
     * 发车日期    "2020-06-06"
     */
    @SerializedName("line_date")
    var lineDate = ""

    /**
     * 发车时间
     */
    @SerializedName("all_line_time")
    var allLineTime = ""

    /**
     * 原票价：分
     */
    @SerializedName("prime_price")
    var primePrice = 0

    /**
     * 销售票价：分
     */
    @SerializedName("sell_price")
    var sellPrice = 0

    /**
     * 售票开始时间
     */
    @SerializedName("sell_time")
    var sellTime = ""


    /**
     * 库存数量
     */
    @SerializedName("store_num")
    var storeNum = 0

    /**
     * 已售票数
     *  if（storeNum==0&&sell_num=0）未排班 storeNume!=0 显示售罄
     */
    @SerializedName("sell_num")
    var sellNum = 0

    /********************客户端生成的字段*****************************/

    var date = java.util.Date()

    var days = ""

    var isDaysTicket = false

    //是否选择
    var isSelected = false

    //是否售罄
    var isCanBuy = true

    //检测服务器是否在当前时间放票
    var isSaleStatus = true


    //https://blog.csdn.net/SmallDade/article/details/51857830
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as CalendarPriceEntity

        if (lineDate != other.lineDate) return false
        if (primePrice != other.primePrice) return false
        if (sellPrice != other.sellPrice) return false
        if (sellTime != other.sellTime) return false
        if (storeNo != other.storeNo) return false
        if (storeNum != other.storeNum) return false
        if (sellNum != other.sellNum) return false
        if (date != other.date) return false
        if (days != other.days) return false
        if (isDaysTicket != other.isDaysTicket) return false
        if (isSelected != other.isSelected) return false
        if (isCanBuy != other.isCanBuy) return false
        if (isSaleStatus != other.isSaleStatus) return false

        return true
    }

    override fun hashCode(): Int {
        var result = lineDate.hashCode()
        result = 31 * result + primePrice
        result = 31 * result + sellPrice
        result = 31 * result + sellTime.hashCode()
        result = 31 * result + storeNo.hashCode()
        result = 31 * result + storeNum
        result = 31 * result + sellNum
        result = 31 * result + date.hashCode()
        result = 31 * result + days.hashCode()
        result = 31 * result + isDaysTicket.hashCode()
        result = 31 * result + isSelected.hashCode()
        result = 31 * result + isCanBuy.hashCode()
        result = 31 * result + isSaleStatus.hashCode()
        return result
    }

    override fun toString(): String {
        return "CalendarPriceEntity(id=$id, storeNo='$storeNo', lineDate='$lineDate', allLineTime='$allLineTime', primePrice=$primePrice, sellPrice=$sellPrice, sellTime='$sellTime', storeNum=$storeNum, sellNum=$sellNum, date=$date, days='$days', isDaysTicket=$isDaysTicket, isSelected=$isSelected, isCanBuy=$isCanBuy, isSaleStatus=$isSaleStatus)"
    }
}